package com.jnu.myfirstapplication;

import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.Window;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.jnu.myfirstapplication.Adapter.CommentRecycleViewAdapter;
import com.jnu.myfirstapplication.data.Comment;

import java.util.ArrayList;

public class CommentPage extends AppCompatActivity {
    public static ArrayList<Comment> comments = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Intent intent=getIntent();
        // 实例化一个Bundle
        Bundle bundle=intent.getExtras();
        //获取里面的Persion里面的数据
        comments = (ArrayList<Comment>) bundle.getSerializable("comments");
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_comment_page);

//        Comment comment =new Comment();
//        comment.setUsername("123");
//        comment.setTime("2022-12-18");
//        comment.setComment("测试评论1111111111111111111111111111111111111111111111111111111111111111111111111111111");
//        comment.setImageUrl("https://img2.doubanio.com/icon/u2889821-202.jpg");
//        comments.add(comment);

        LinearLayoutManager manager = new LinearLayoutManager(this);
        RecyclerView recyclerView = findViewById(R.id.comment_recycleview);
        recyclerView.setLayoutManager(manager);
        CommentRecycleViewAdapter adapter = new CommentRecycleViewAdapter();
        recyclerView.setAdapter(adapter);
    }
}